package com.eorchis.module.deptassignedinfo.dao.impl;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.eorchis.core.basedao.dao.impl.HibernateAbstractBaseDao;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.basedao.query.condition.IPagingQueryCondition;
import com.eorchis.core.basedao.query.condition.builder.CompareType;
import com.eorchis.core.basedao.query.condition.builder.IConditionBuilder;
import com.eorchis.core.basedao.query.condition.builder.impl.DefaultQueryConditionBuilder;
import com.eorchis.core.page.commond.SortInfoBean;
import com.eorchis.core.ui.commond.IQueryCommond;
import com.eorchis.module.TrainingConstants;
import com.eorchis.module.classdept.ui.commond.ClassDeptValidCommond;
import com.eorchis.module.classuser.domain.ClassUser;
import com.eorchis.module.deptassignedinfo.dao.IDeptAssignedInfoDao;
import com.eorchis.module.deptassignedinfo.domain.DepAssigneInfoQueryBean;
import com.eorchis.module.deptassignedinfo.domain.DeptAssignedInfo;
import com.eorchis.module.deptassignedinfo.domain.DeptAssignedInfoBean;
import com.eorchis.module.deptassignedinfo.ui.commond.DeptAssignedInfoQueryCommond;
import com.eorchis.module.deptassignedinfo.ui.commond.DeptAssignedInfoValidCommond;
import com.eorchis.utils.utils.PropertyUtil;

/**
 * Title: DeptAssignedInfoDaoImpl<br>
 * Description: 单位年度参学名额表数据接口实现<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author Administrator
 * @createDate 2014-12-29
 * @version $Revision$
 */
@SuppressWarnings("unchecked")
@Repository(value = "com.eorchis.module.deptassignedinfo.dao.impl.DeptAssignedInfoDaoImpl")
public class DeptAssignedInfoDaoImpl extends HibernateAbstractBaseDao implements IDeptAssignedInfoDao {
	
	@Override
	public Class<? extends IBaseEntity> entityClass() {
		return DeptAssignedInfo.class;
	}

	@Override
	public void queryConditionProcessor(
			IConditionBuilder defaultQueryConditionBuilder,
			IQueryCommond queryCommond) {
		DeptAssignedInfoQueryCommond deptAssignedInfoQueryCommond = (DeptAssignedInfoQueryCommond)queryCommond;
		defaultQueryConditionBuilder.setBaseQueryString("SELECT t FROM DeptAssignedInfo t");
		defaultQueryConditionBuilder.addCondition("t.id", CompareType.IN, deptAssignedInfoQueryCommond.getSearchIds());
		defaultQueryConditionBuilder.addCondition("t.department.depid", CompareType.EQUAL, deptAssignedInfoQueryCommond.getSearchDepId());
		defaultQueryConditionBuilder.addCondition("t.year", CompareType.EQUAL, deptAssignedInfoQueryCommond.getSearchYear());
		defaultQueryConditionBuilder.addCondition("t.classType", CompareType.EQUAL, deptAssignedInfoQueryCommond.getSearchClassType());
		defaultQueryConditionBuilder.addCondition("t.department.depid", CompareType.IN, deptAssignedInfoQueryCommond.getSearchDepIds());
	}
	/**
	 * 查询分配参学名额列表
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2014-12-29
	 */
	@Override
	public List<DeptAssignedInfoBean> findDeptAssignedInfoList(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		List<DeptAssignedInfoBean> result=null;
		//拼写查询的sql
		String sql="select r.id as \"id\",r.year as \"year\",r.restrict_person_num as \"restrictPersonNum\",r.class_type as \"classType\",r.depid as \"deptId\",r.depname as \"deptName\",r.deptUserNum as \"deptUserNum\" " +
				" from (select t.id,t.year,t.restrict_person_num,t.class_type,t.depid,bd.depname,(select count(u.userid) from base_department_user du, base_department bt, base_user u " +
				" where bt.depid = du.depid and du.userid = u.userid and du.active_state="+TrainingConstants.IS_ACTIVE_Y+" and u.active_state="+TrainingConstants.IS_ACTIVE_Y+""+
				" and bt.treepath like CONCAT((select dd.treepath from base_department dd where dd.depid = t.depid),'%')) as deptUserNum " +//部门人数(包括下级部门的人数)
				" from DEPT_ASSIGNED_INFO t left join signup_dept bd on t.depid=bd.depid where 1=1 ";
		//拼写查询条件sql
		Map<String, Object> values = new HashMap<String, Object>();
		//按照培训班类型查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchClassType())){
			sql+=" and t.class_type =:classType ";
			values.put("classType", queryCommond.getSearchClassType());
		}
		//按照单位id查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())){
			sql+=" and t.depid=:depid ";
			values.put("depid", queryCommond.getSearchDepId());
		}
		//按照单位名称查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepname())){
			sql+=" and bd.depname like :depName ";
			values.put("depName", "%"+queryCommond.getSearchDepname().trim()+"%");
		}
		//按照年份查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchYear())){
			sql+=" and t.year =:year ";
			values.put("year", queryCommond.getSearchYear());
		}
		sql+=") r ";
		//拼写排序的
		List<SortInfoBean> sortInfoList = queryCommond.getSortInfo();
		if (sortInfoList != null && sortInfoList.size() > 0) {
			SortInfoBean sortInfo = sortInfoList.get(0);
			sql+=" order by " + PropertyUtil.sqlInjectionFilter(sortInfo.getProperty()) + " " + PropertyUtil.sqlInjectionFilter(sortInfo.getDirection());
		}
		IConditionBuilder defaultQueryConditionBuilder  = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.SQL);
		defaultQueryConditionBuilder.setBaseQueryString(sql);
		defaultQueryConditionBuilder.setResultObject(DeptAssignedInfoBean.class);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(values);
		//查询总数量
		Long count = this.count(queryCondition);
		int firstResult = queryCommond.calculate(count.longValue());
		result = (List<DeptAssignedInfoBean>)this.findList(queryCondition, firstResult, queryCommond.getLimit());
		return result;
	}
	/**
	 * 修改分配参学名额列表上的限定人数
	 * @param validCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2014-12-30
	 */
	@Override
	public boolean updateDeptAssignedInfo(
			DeptAssignedInfoValidCommond validCommond) throws Exception {
		boolean result = false;
		String hql = "update DEPT_ASSIGNED_INFO c set c.RESTRICT_PERSON_NUM=:restrictPersonNum where c.ID=:id ";
		Map<String,Object> params = new Hashtable<String,Object>();
		params.put("id", validCommond.getId());
		params.put("restrictPersonNum", validCommond.getRestrictPersonNum());
		int u  = this.executeUpdate(QueryStringType.SQL, hql.toString(), params);
		if (u == 1) {
			result = true;
		}
		return result;
	}
	/**
	 * 分配参学名额:未选单位列表
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2014-12-30
	 */
	@Override
	public List<DeptAssignedInfoBean> findNoSelectSignupDeptList(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		List<DeptAssignedInfoBean> result=null;
		Map<String, Object> values = new HashMap<String, Object>();
		//拼写查询的sql
		String sql="select r.depid as \"deptId\",r.depname as \"deptName\",r.parentDeptName as \"parentDeptName\",r.deptUserNum as \"deptUserNum\" " +
				" from (select t.depid,t.depname,(select count(u.userid) from base_department_user du, base_department bt, base_user u " +
				" where bt.depid = du.depid and du.userid = u.userid and du.active_state ="+TrainingConstants.IS_ACTIVE_Y+" and u.active_state ="+TrainingConstants.IS_ACTIVE_Y+""+
				" and bt.treepath like CONCAT((select dd.treepath from base_department dd where dd.depid = t.depid),'%')) as deptUserNum," +//部门人数(包括下级部门的人数)
				" (select sd.depname from base_department sd  where sd.depid = t.parent_id) as parentDeptName" +//父级部门名称
				" from signup_dept t where t.depid not in (select di.depid from dept_assigned_info di where 1=1 ";
		//年份
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchYear())){
			sql+=" and di.year =:year ";
			values.put("year", queryCommond.getSearchYear());
		}
		//培训班类型
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchClassType())){
			sql+=" and di.class_type =:classType ";
			values.put("classType", queryCommond.getSearchClassType());
		}
		sql+=") ";//去掉已经选入单位年度参学名额表中的部门
		//按照父级部门ID查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchParentId())){
			sql+=" and t.parent_id =:parentId ";
			values.put("parentId", queryCommond.getSearchParentId());
		}
		//按照部门名称查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepname())){
			sql+=" and t.depname like :depname ";
			values.put("depname", "%"+queryCommond.getSearchDepname().trim()+"%");
		}
		sql+=") r ";
		//拼写排序的
		List<SortInfoBean> sortInfoList = queryCommond.getSortInfo();
		if (sortInfoList != null && sortInfoList.size() > 0) {
			SortInfoBean sortInfo = sortInfoList.get(0);
			sql+=" order by " + PropertyUtil.sqlInjectionFilter(sortInfo.getProperty()) + " " + PropertyUtil.sqlInjectionFilter(sortInfo.getDirection());
		}
		IConditionBuilder defaultQueryConditionBuilder  = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.SQL);
		defaultQueryConditionBuilder.setBaseQueryString(sql);
		defaultQueryConditionBuilder.setResultObject(DeptAssignedInfoBean.class);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(values);
		//查询总数量
		Long count = this.count(queryCondition);
		int firstResult = queryCommond.calculate(count.longValue());
		result = (List<DeptAssignedInfoBean>)this.findList(queryCondition, firstResult, queryCommond.getLimit());
		return result;
	}
	/**
	 * 根据部门ids查询部门中参加培训的人数
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2014-12-31
	 */
	@Override
	public Long getCountJoinTrainingClassUser(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		Map<String,Object> values = new Hashtable<String,Object>();
		String sql="select count(tu.class_user_id) from TRAINING_CLASS_USER tu  left join TRAINING_CLASS tc on tu.class_id = tc.class_id " +
				" left join base_user bu on tu.user_id = bu.userid left join BASE_DEPARTMENT_USER bd on bu.userid = bd.userid " +
				" left join DEPT_ASSIGNED_INFO da on bd.depid = da.depid where tu.active_state="+TrainingConstants.IS_ACTIVE_Y+" and tu.auditing_state="+ClassUser.IS_AUDITING_Y+""+
				" and tc.active_state="+TrainingConstants.IS_ACTIVE_Y+" and tc.audit_state="+ClassUser.IS_AUDITING_Y+" and bu.active_state="+TrainingConstants.IS_ACTIVE_Y+"  and bd.active_state="+TrainingConstants.IS_ACTIVE_Y+" ";
		//按照年份查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchYear())){
			sql+=" and da.year=:year1 and tc.classname_year=:year2";
			values.put("year1",queryCommond.getSearchYear());
			values.put("year2",queryCommond.getSearchYear());
		}
		//按照培训班类型查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchClassType())){
			sql+=" and da.class_type=:classType and tc.class_type in (:classTypes)";
			values.put("classType",queryCommond.getSearchClassType());
			values.put("classTypes",queryCommond.getSearchClassTypes());
		}
		//按照部门ids查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepIds())){
			sql+=" and da.depid in (:depIds)";
			values.put("depIds",queryCommond.getSearchDepIds());
		}
		IConditionBuilder defaultQueryConditionBuilder  = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.SQL);
		defaultQueryConditionBuilder.setBaseQueryString(sql);
		defaultQueryConditionBuilder.setResultObject(DeptAssignedInfoBean.class);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(values);
		//查询总数量
		Long count = this.count(queryCondition);
		return count;
	}
	
	/**
	 * 查询这个班级类型在某个年度某个单位的报名限额
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2015-1-7
	 */
	@Override
	public Integer getNumByYearAndDept(String searchDepId,String searchClassType,
			String searchYear) throws Exception {
		Map<String, Object> values = new HashMap<String, Object>();
		String hql="select c.restrictPersonNum as courseCountNum from DeptAssignedInfo c where c.department.depid=:depid ";
		hql+=" and c.year=:year and c.classType=:classType";
		values.put("depid", searchDepId);
		values.put("year", Integer.parseInt(searchYear));
		values.put("classType", Integer.parseInt(searchClassType));
		List<Object> list=(List<Object>) this.executeFind(QueryStringType.HQL,hql,values);
		if(list==null) {
			return 0;
		}else if(list.size()==0){
			return 0;
		}else {
			return Integer.parseInt(list.get(0).toString());
		}
	}
	
	
	/**
	 * 修改班级限额
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2015-1-7
	 */
	@Override
	public void updateClassDeptNum(ClassDeptValidCommond vCommond) throws Exception{
		Map<String, Object> values = new HashMap<String, Object>();
		String hql="update ClassDept cd set cd.limitNum=:limitNum where cd.classDeptId=:classDeptId";
		values.put("limitNum", vCommond.getLimitNum());
		values.put("classDeptId", vCommond.getClassDeptId());
		this.executeUpdate(QueryStringType.HQL, hql, values);
	}

	@Override
	public int findgfDeptAssignedInfo(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append(" select count(*) as \"ROWNUM_\" from TRAINING_CLASS_DEPT t, dept_assigned_info di , BASE_DEPARTMENT  s,  Training_class_user u, Training_Class   c");
		sql.append(" where s.depid = t.depid   and s.treepath like  CONCAT((select dd.treepath from base_department dd where dd.depid = :depId ),'%')  " );
		sql.append("  and u.class_id = t.class_id    and c.class_id = t.class_id    and c.class_type =:classTypeStr  and di.class_type =:classType ");
		sql.append(" and di.depid =s.depid and  di.year =:year  ");
		Map<String, Object> values = new HashMap<String, Object>();
		values.put("depId", queryCommond.getSearchDepId());
		values.put("classType",queryCommond.getSearchClassType());
		if(queryCommond.getSearchClassType()==1){
			values.put("classTypeStr", "ptb");
		}else{
			values.put("classTypeStr", "gfb");
		}
		values.put("year", queryCommond.getSearchYear());
		BigDecimal a= (BigDecimal) this.executeFind(QueryStringType.SQL, sql.toString(), values).get(0);
		return a.intValue();
	}
	
	@Override
	public int findptDeptAssignedInfo(DeptAssignedInfoQueryCommond queryCommond)
			throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append("select count(*) from base_department t, base_department_user bu,Training_class_user tu,training_class c where t.depid=bu.depid and t.treepath like "); 
	   sql.append(" CONCAT((select dd.treepath from base_department dd where dd.depid =:depId ),'%')");
	    sql.append(" and bu.userid = tu.user_id and c.class_id = tu.class_id and c.class_type in (:classTypeStr) ");
		Map<String, Object> values = new HashMap<String, Object>();
		String [] str= new String[]{"ptb","dxb"};
		values.put("depId", queryCommond.getSearchDepId());
			values.put("classTypeStr", str);
		values.put("year", queryCommond.getSearchYear());
		BigDecimal a= (BigDecimal) this.executeFind(QueryStringType.SQL, sql.toString(), values).get(0);
		return a.intValue();
	}
	
	
	/**
	 * 查询分配参学名额列表汇总人数
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2015-01-23
	 */
	@Override
	public Integer findDeptAssignedNumInfo(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		//拼写查询的sql
		String sql=" select sum(t.restrict_person_num)  from DEPT_ASSIGNED_INFO t inner join signup_dept bd on t.depid = bd.depid";
		
		Map<String, Object> values = new HashMap<String, Object>();
		//按照培训班类型查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchClassType())){
			sql+=" and t.class_type =:classType ";
			values.put("classType", queryCommond.getSearchClassType());
		}
		//按照单位id查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())){
			sql+=" and t.depid=:depid ";
			values.put("depid", queryCommond.getSearchDepId());
		}
		
		if (queryCommond.getSearchDepname() != null
				&& !"".equals(queryCommond.getSearchDepname())) {
			sql+=" and bd.DEPNAME like :deptName ";
			values.put("deptName", "%" + queryCommond.getSearchDepname().trim()+ "%");
		}
		//按照年份查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchYear())){
			sql+=" and t.year =:year ";
			values.put("year", queryCommond.getSearchYear());
		}
		List<BigDecimal> list=(List<BigDecimal>) this.executeFind(QueryStringType.SQL, sql, values);
		if(list!=null&&list.size()>0) {
			BigDecimal l=list.get(0);
			if(l==null) {
				return 0;
			}
			return Integer.parseInt(l.toString());
		}
		return 0;
	}
	
	/**
	 * 导出
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author Max
	 * @date 2015-01-27
	 */
	@Override
	public List<DeptAssignedInfoBean> ExpertDeptAssignedInfoList(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		List<DeptAssignedInfoBean> result=null;
		//拼写查询的sql
		String sql="select r.id as \"id\",r.year as \"year\",r.restrict_person_num as \"restrictPersonNum\",r.class_type as \"classType\",r.depid as \"deptId\",r.depname as \"deptName\",r.deptUserNum as \"deptUserNum\" " +
				" from (select t.id,t.year,t.restrict_person_num,t.class_type,t.depid,bd.depname,(select count(u.userid) from base_department_user du, base_department bt, base_user u " +
				" where bt.depid = du.depid and du.userid = u.userid and du.active_state="+TrainingConstants.IS_ACTIVE_Y+" and u.active_state="+TrainingConstants.IS_ACTIVE_Y+""+
				" and bt.treepath like CONCAT((select dd.treepath from base_department dd where dd.depid = t.depid),'%')) as deptUserNum " +//部门人数(包括下级部门的人数)
				" from DEPT_ASSIGNED_INFO t left join signup_dept bd on t.depid=bd.depid where 1=1 ";
		//拼写查询条件sql
		Map<String, Object> values = new HashMap<String, Object>();
		//按照培训班类型查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchClassType())){
			sql+=" and t.class_type =:classType ";
			values.put("classType", queryCommond.getSearchClassType());
		}
		//按照单位id查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())){
			sql+=" and t.depid=:depid ";
			values.put("depid", queryCommond.getSearchDepId());
		}
		//按照单位名称查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepname())){
			sql+=" and bd.depname like :depName ";
			values.put("depName", "%"+queryCommond.getSearchDepname().trim()+"%");
		}
		//按照年份查询
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchYear())){
			sql+=" and t.year =:year ";
			values.put("year", queryCommond.getSearchYear());
		}
		sql+=") r ";
		//拼写排序的
		List<SortInfoBean> sortInfoList = queryCommond.getSortInfo();
		if (sortInfoList != null && sortInfoList.size() > 0) {
			SortInfoBean sortInfo = sortInfoList.get(0);
			sql+=" order by " + PropertyUtil.sqlInjectionFilter(sortInfo.getProperty()) + " " + PropertyUtil.sqlInjectionFilter(sortInfo.getDirection());
		}
		IConditionBuilder defaultQueryConditionBuilder  = new DefaultQueryConditionBuilder();
		defaultQueryConditionBuilder.setQueryStringType(QueryStringType.SQL);
		defaultQueryConditionBuilder.setBaseQueryString(sql);
		defaultQueryConditionBuilder.setResultObject(DeptAssignedInfoBean.class);
		IPagingQueryCondition queryCondition = (IPagingQueryCondition) defaultQueryConditionBuilder.buliderQueryCondition();
		queryCondition.setParameters(values);
		//查询总数量
//		Long count = this.count(queryCondition);
//		int firstResult = queryCommond.calculate(count.longValue());
		result = (List<DeptAssignedInfoBean>)this.findList(queryCondition);
		return result;
	}
	
	/*
	 * 查询单位报名人数  by Max at 2015-02-17
	 */
	@Override
	public int findgfDeptAssInfo(
			DeptAssignedInfoQueryCommond queryCommond) throws Exception {
		StringBuffer sql = new StringBuffer();
		
		sql.append(" select count(*) as \"ROWNUM_\" from Training_class_user  tcu, Training_Class c, base_user u, base_department_user du, base_department d ");
		sql.append(" where c.class_id = tcu.class_id and du.userid=u.userid and du.depid=d.depid and tcu.user_id=u.userid ");
		sql.append(" and d.treepath like CONCAT((select dd.treepath from base_department dd where dd.depid = :depId), '%')");
		sql.append(" and c.classname_year=:year");
		Map<String, Object> values = new HashMap<String, Object>();
		values.put("year", queryCommond.getSearchYear());   
		values.put("depId", queryCommond.getSearchDepId());
		
		if(queryCommond.getSearchClassType()==1){
			sql.append(" and c.class_type != 'gfb'");
		}else{
			sql.append(" and c.class_type = 'gfb'");
		}
//		sql.append(" select count(*) as \"ROWNUM_\" from TRAINING_CLASS_DEPT t, dept_assigned_info di , BASE_DEPARTMENT  s,  Training_class_user u, Training_Class   c");
//		sql.append(" where s.depid = t.depid   and s.treepath like  CONCAT((select dd.treepath from base_department dd where dd.depid = :depId ),'%')  " );
//		sql.append("  and u.class_id = t.class_id    and c.class_id = t.class_id    and c.class_type =:classTypeStr  and di.class_type =:classType ");
//		sql.append(" and di.depid =s.depid and  di.year =:year  ");
//		Map<String, Object> values = new HashMap<String, Object>();
//		values.put("depId", queryCommond.getSearchDepId());
//		values.put("classType",queryCommond.getSearchClassType());
//		if(queryCommond.getSearchClassType()==1){
//			values.put("classTypeStr", "ptb");
//		}else{
//			values.put("classTypeStr", "gfb");
//		}
//		values.put("year", queryCommond.getSearchYear());
		BigDecimal a= (BigDecimal) this.executeFind(QueryStringType.SQL, sql.toString(), values).get(0);
		return a.intValue();
	}
}
